#ifndef TMS_DEFS_
#define TMS_DEFS_

#pragma once

#include <string>

#ifdef _WIN32
#define TMS_WIN32_PLATFORM
#else
#define TMS_POSIX_PLATFORM
#endif

#define TMS_UI_LANGUAGE_CN
// #define TMS_UI_LANGUAGE_EN

#define TMS_DB_COMMIT_ENABLE

// 系统默认设置
namespace tms
{
    const std::string TIME_TABLE_DB_FILE = "../db/time_table.csv";
    const std::string USER_DB_FILE = "../db/user.csv";
    const std::string SALES_DB_FILE = "../db/sales.csv";
    const std::string ADMIN_PASSWD = "vain";

    const int UI_RESERVED_HEIGHT = 3;
};

// 静态字符串
namespace tms
{
    // UI 初始化值，只在测试UI时有效，正常运行都会动态刷新
    const std::string DINFO = "Welcome to Ticket Manage System.";
    const std::string DPROMOTE = "Press any key to continue.";
    const std::string DMENU_LOC = "Home";
    const std::string DTIME_STR = "12:00";
    const std::string DAPPVERSION = "0.0.c872d42";
    const int DINPUT_ECHO = 1;

    // VT100 color
    const std::string RED_BG = "\033[41m";
    const std::string YELLOW_BG = "\033[43m";
    const std::string BLUE_BG = "\033[44m";
    const std::string GREEN_BG = "\033[42m";
    const std::string RESET_BG = "\033[0m";

    // 时间逻辑
    const int BOARDING_THER = 10;
    const int TICKETS_CHECK_THER = 5;
    const double SERVICE_CHARGE = 0.05;

    // UI topbar 常量
    const std::string DTIME_PREFIX = "        CURT TIME: ";
    const std::string DVERSION_PRIFIX = "VER: ";
    const std::string TAB = "    ";

#ifdef TMS_UI_LANGUAGE_EN
    // UI 提示词
    const std::string PRESS_ANY_KEY_CTU = "Press any key to continue.";
    const std::string PERSS_ANY_KEY_RETRY = "Press any key to retry.";
    const std::string PERSS_ANY_KEY_EXIT = "Press any key to exit.";
    const std::string INPUT_NAME = "Input you name ";
    const std::string INPUT_ID = "Input you account's id ";
    const std::string INPUT_PASSWD = "Input you account's password ";
    const std::string CONFIRM_PROMOTE = "Confirm the operation ";
    const std::string STRING_UNIT = "[string]:";
    const std::string TIME_SPOT_UNIT = "[hh:mm]:";
    const std::string DURATION_UNIT = "[XXhXXm]:";
    const std::string NUMBER_UNIT = "[number]:";
    const std::string CONFIRM_UNIT = "[Y/n]:";
    const std::string TAB_TRAIN_ID = "Train id";
    const std::string TAB_LAUNCH_TIME = "Launch time";
    const std::string TAB_LAUNCH_SPOT = "Launch spot";
    const std::string TAB_ARRIVE_SPOT = "Arrive spot";
    const std::string TAB_DURATION = "Duration";
    const std::string TAB_PRICE = "Price";
    const std::string TAB_CAPACITY = "Capacity";
    const std::string TAB_SOLD_TICKETS = "Sold tickets";
    const std::string TAB_CANCEL = "Canceled";
    const std::string TAB_TICKET_ID = "Tickets ID";
    const std::string TAB_TIME_ID = "Time Table ID";
    const std::string TAB_BUYER_ID = "Buyer ID";
    const std::string TAB_USER_ID = "User ID";
    const std::string TAB_USER_NAME = "Name";
    const std::string TAB_USER_PASSWD = "Password";
    const std::string TAB_WALLET = "Wallet";

    // 错误
    const std::string MODI_FAIL_DB = "Modify failed because of data base access error.";
    const std::string MODI_FAIL_FILE = "Modify failed because of system file access error.";
    const std::string SCHE_NOT_FOUND_ERR = "Train not found.";
    const std::string ABORT_OPERATION = "Abort operation!";
    const std::string USER_NOT_FOUND_ERR = "User not found.";
    const std::string OPEN_FILE_ERR = "Can not open file.";
    const std::string CSV_PRASE_ERR = "CSV has rows which is invalid.";
    const std::string ROW_NOT_FOUND = "Row not found.";
    const std::string DATA_SHAPE_ERR = "Data to update with invalid shape.";
    const std::string USER_ID_EXIST_ERR = "User ID already exists.";
    const std::string PASSWD_INCORRECT = "Incorrect password.";
    const std::string TRAIN_CANCEL_ERR = "Train has been canceled.";
    const std::string MODI_ARRIV_SPOT_SUCCESS = "Modify arrival spot successed.";
    const std::string MODI_LAUNC_SPOT_SUCCESS = "Modify launch spot successed.";
    const std::string MODI_LAUNC_TIME_SUCCESS = "Modify launch time successed.";
    const std::string MODI_NAME_SUCCESS = "Modify name successed.";
    const std::string MODI_PASSWD_SUCCESS = "Modify password successed.";
    const std::string MODI_DURATION_SUCCESS = "Modify duration successed.";
    const std::string MODI_TICKET_PRICE_SUCCESS = "Modify ticket price successed.";
    const std::string TICKETS_TIME_OUTTIME_ERR = "Cannot purchase or refund ticket within limited minutes before departure or after departure.";
    const std::string BUY_SAME_TICKET_ERR = "User has already purchased a ticket for this train.";
    const std::string WALLET_RUN_OUT_ERR = "Your wallet is not enought to pay the ticket price.";
    const std::string NO_SIT_TO_SALE = "No avaliable sit.";
    const std::string NO_TICKET_FOUND = "No ticket found.";
    const std::string NOT_THIS_USER_TICKET = "This is not your ticket.";
    const std::string INPUT_INVALID = "Your input can not be prase to target type!";

    // 管理员相关选项
    const std::string ADMINISTRATOR_LOGIN = "Administrator Login";
    const std::string DISPLAY_STATISTICS_PAGE = "Display statistics page";
    const std::string CANCEL_BUS = "Cancel bus";
    const std::string READ_USER_DATA = "Read user data";
    const std::string DELETE_USER = "Delete user";
    const std::string ANALYZE_BUS_DATA = "Analyze bus data";
    const std::string DELETE_BUS = "Delete bus in time table";
    const std::string EXPORT_LOG = "Export log file";
    const std::string ADD_BUS = "Add new bus item";
    const std::string READ_TIME_TABLE = "Read time table";
    const std::string MODIFY_TIME_TABLE = "Modify time table";
    const std::string MODIFY_USER_DATA = "Modify user data";
    const std::string MODIFY_SPOT_LAUNCH = "Modify spot launch";
    const std::string MODIFY_SPOT_ARRIVAL = "Modify spot arrival";
    const std::string MODIFY_LAUNCH_TIME = "Modify launch time";
    const std::string MODIFY_DURATION = "Modify duration";
    const std::string MODIFY_TICKET_PRICE = "Modify ticket price";
    const std::string MODIFY_USER_NAME = "Modify user name";
    const std::string MODIFY_USER_PASSWD = "Modify user pass word";

    // 普通用户相关选项
    const std::string CUSTOMER_LOGIN = "Customer Login";
    const std::string MODIFY_MY_PROFILE = "Modify my profile";
    const std::string PERSONAL_PANEL = "Personal panel";
    const std::string ALL_BUS_ITEMS = "All bus items";
    const std::string SEARCH_BUS_TICKET = "Search bus ticket";
    const std::string BUY_BUS_TICKET = "Buy bus ticket";
    const std::string REFUND_BUS_TICKET = "Refund bus ticket";
    const std::string MODIFY_MY_USER_NAME = "Modify my user name";
    const std::string MODIFY_MY_PASSWORD = "Modify my password";
    const std::string CHARGE_MY_POCKET = "Charge my pocket";

    // 其他选项
    const std::string REGISTER_NEW_USER = "Register new user";

    // 节点专用字符串常量
    const std::string ADMIN_LOGIN_INFO = "Please input pass word for administor.";
    const std::string ADMIN_INPUT_PASSWD = "Input pass word for administor ";
    const std::string USER_LOGIN_INFO = "Please input your User ID";
    const std::string USER_INPUT_PASSWD = "Only input your User ID ";
    const std::string USER_PASSWD_INPUT_INFO = "Please input pass word for account: ";
    const std::string MODI_SCHE_INPUT_ID = "Enter the ID of the train to modify: ";

    const std::string NEW_ARRIV_SPOT = "Input new arrival spot of bus ";
    const std::string NEW_LAUNC_SPOT = "Input new launch spot of bus ";
    const std::string NEW_LAUNC_TIME = "Input new launch time of bus ";
    const std::string NEW_DURATION = "Input new duration of bus ";
    const std::string NEW_TICKET_PRICE = "Input new ticket price of bus ";
    const std::string NEW_CAPICITY = "Input new capicity of the bus ";
    const std::string NEW_USER_NAME = "Input new name for user ";
    const std::string NEW_USER_PASSWD = "Input new password for user ";

    const std::string CANCEL_BUS_PROMOTE = "Enter the ID of the train to cancel ";
    const std::string CONFIRM_BUS_CANCEL = "Are you sure to cancel train: ";
    const std::string BUS_DELETE_SUCCESS = " bus deleted successfully.";
    const std::string MODI_INPUT_USER_ID = "Enter the ID of the user to modify ";
    const std::string DEL_USER_NAME = "Enter the ID of the user to delete ";
    const std::string DEL_USER_SUCCESS = "Delete user success.";
    const std::string ANS_BUS_TITLE = "Bus Analysis:";
    const std::string ANS_BUS_ID = "Bus ID: ";
    const std::string ANS_BUS_OC_RAT = "Occupancy Rate: ";
    const std::string ANS_BUS_WHERE = "Where: ";

    const std::string USER_WELCOME = "Welcome to use TMS! ";
    const std::string USER_WALLET_PREFIX = "Your wallet balance: ";
    const std::string USER_TICKET_PREFIX = "Your tickets count: ";
    const std::string USER_ALL_TICKETS = "All tickets: ";
    const std::string USER_SEARCH_BUS_DEST = "Enter destination ";
    const std::string PROC_TICKET_PROMOTE = "Enter the ID of the bus ";
    const std::string PROC_TICKET_SUCCESS = "Purchase ticket success ";
    const std::string REFUND_TICKET_PROMOTE = "Enter the ID of the ticket to refund ";
    const std::string REFUND_TICKER_SUCCESS = "Refund ticket success.";
    const std::string CHARGE_MONY = "Enter amount to charge ";
    const std::string ASK_DELETE_BUS_ID = "Enter the bus id to delete ";
    const std::string DELETE_BUS_SUCCESS = "Delete bus successful.";
    const std::string EXPORT_LOG_PATH = "Enter export file path ";
    const std::string EXPORT_LOG_PROMOTE = "Export system log file ";
    const std::string EXPORT_LOG_SUCCESS = "Export system log successful.";
    const std::string ADD_NEW_BUS = "Fill the bus table: ";
    const std::string ADD_NEW_BUS_SUCCESS = "Add new bus success!";

    const std::string EXIT_NODE = "EXIT";
    const std::string MENU_SELECT_L = "Select the sub menu [0-";
    const std::string MENU_SELECT_R = "] and ";
    const std::string MENU_SELECT_END = " for EXIT: ";
    const std::string HOME_TITLE = "Tms HOME";
    const std::string TMS_VERSION = "0.0.a3b043d";

    // 注册引导
    const std::string WELCOME = "Welcome to Tickets mamage system!\nInput you name first.";
    const std::string ASK_NAME = "Your name [string] and [ENTER]:";
    const std::string GET_ID = "Input a ID for your new account\nWARNNING: this is a parment choice.";
    const std::string ASK_ID = "Your user ID [string] and [ENTER]:";
    const std::string GET_PASSWD = "Input a initial password for your new account.";
    const std::string ASK_PASSWD = "Your password [no echo string] and [ENTER]:";
    const std::string THANKS = "You has successfully registed!";
#endif

#ifdef TMS_UI_LANGUAGE_CN
    // UI 提示词
    const std::string PRESS_ANY_KEY_CTU = "按任意键继续。";
    const std::string PERSS_ANY_KEY_RETRY = "按任意键重试。";
    const std::string PERSS_ANY_KEY_EXIT = "按任意键退出。";
    const std::string INPUT_NAME = "输入您的姓名 ";
    const std::string INPUT_ID = "输入您的账号ID ";
    const std::string INPUT_PASSWD = "输入您的账号密码 ";
    const std::string CONFIRM_PROMOTE = "确认操作 ";
    const std::string STRING_UNIT = "[字符串]：";
    const std::string TIME_SPOT_UNIT = "[时:分]：";
    const std::string DURATION_UNIT = "[XX时XX分]：";
    const std::string NUMBER_UNIT = "[数字]：";
    const std::string CONFIRM_UNIT = "[是/否]：";
    const std::string TAB_TRAIN_ID = "列车编号";
    const std::string TAB_LAUNCH_TIME = "发车时间";
    const std::string TAB_LAUNCH_SPOT = "发车地点";
    const std::string TAB_ARRIVE_SPOT = "到达地点";
    const std::string TAB_DURATION = "行程时长";
    const std::string TAB_PRICE = "票价";
    const std::string TAB_CAPACITY = "载客量";
    const std::string TAB_SOLD_TICKETS = "已售车票";
    const std::string TAB_CANCEL = "已取消";
    const std::string TAB_TICKET_ID = "车票编号";
    const std::string TAB_TIME_ID = "时刻表编号";
    const std::string TAB_BUYER_ID = "购票人ID";
    const std::string TAB_USER_ID = "用户ID";
    const std::string TAB_USER_NAME = "姓名";
    const std::string TAB_USER_PASSWD = "密码";
    const std::string TAB_WALLET = "钱包余额";

    // 错误
    const std::string MODI_FAIL_DB = "由于数据库访问错误，修改失败。";
    const std::string MODI_FAIL_FILE = "由于系统文件访问错误，修改失败。";
    const std::string SCHE_NOT_FOUND_ERR = "未找到列车。";
    const std::string ABORT_OPERATION = "操作中止！";
    const std::string USER_NOT_FOUND_ERR = "未找到用户。";
    const std::string OPEN_FILE_ERR = "无法打开文件。";
    const std::string CSV_PRASE_ERR = "CSV文件包含无效行。";
    const std::string ROW_NOT_FOUND = "未找到行。";
    const std::string DATA_SHAPE_ERR = "用于更新的数据格式无效。";
    const std::string USER_ID_EXIST_ERR = "用户ID已存在。";
    const std::string PASSWD_INCORRECT = "密码错误。";
    const std::string TRAIN_CANCEL_ERR = "列车已取消。";
    const std::string MODI_ARRIV_SPOT_SUCCESS = "到达地点修改成功。";
    const std::string MODI_LAUNC_SPOT_SUCCESS = "发车地点修改成功。";
    const std::string MODI_LAUNC_TIME_SUCCESS = "发车时间修改成功。";
    const std::string MODI_NAME_SUCCESS = "名称修改成功。";
    const std::string MODI_PASSWD_SUCCESS = "密码修改成功。";
    const std::string MODI_DURATION_SUCCESS = "行程时长修改成功。";
    const std::string MODI_TICKET_PRICE_SUCCESS = "票价修改成功。";
    const std::string TICKETS_TIME_OUTTIME_ERR = "发车前或发车后限定分钟内无法购票或退票。";
    const std::string BUY_SAME_TICKET_ERR = "用户已购买此列车车票。";
    const std::string WALLET_RUN_OUT_ERR = "您的钱包余额不足支付票价。";
    const std::string NO_SIT_TO_SALE = "无可用座位。";
    const std::string NO_TICKET_FOUND = "未找到车票。";
    const std::string NOT_THIS_USER_TICKET = "这不是您的车票。";
    const std::string INPUT_INVALID = "您的输入无法转换为目标类型！";

    // 管理员相关选项
    const std::string ADMINISTRATOR_LOGIN = "管理员登录";
    const std::string DISPLAY_STATISTICS_PAGE = "显示统计页面";
    const std::string CANCEL_BUS = "取消车次";
    const std::string READ_USER_DATA = "读取用户数据";
    const std::string DELETE_USER = "删除用户";
    const std::string ANALYZE_BUS_DATA = "分析车次数据";
    const std::string DELETE_BUS = "从时刻表中删除车次";
    const std::string EXPORT_LOG = "导出日志文件";
    const std::string ADD_BUS = "添加新车次";
    const std::string READ_TIME_TABLE = "读取时刻表";
    const std::string MODIFY_TIME_TABLE = "修改时刻表";
    const std::string MODIFY_USER_DATA = "修改用户数据";
    const std::string MODIFY_SPOT_LAUNCH = "修改发车地点";
    const std::string MODIFY_SPOT_ARRIVAL = "修改到达地点";
    const std::string MODIFY_LAUNCH_TIME = "修改发车时间";
    const std::string MODIFY_DURATION = "修改行程时长";
    const std::string MODIFY_TICKET_PRICE = "修改票价";
    const std::string MODIFY_USER_NAME = "修改用户名";
    const std::string MODIFY_USER_PASSWD = "修改用户密码";

    // 普通用户相关选项
    const std::string CUSTOMER_LOGIN = "顾客登录";
    const std::string MODIFY_MY_PROFILE = "修改个人资料";
    const std::string PERSONAL_PANEL = "个人面板";
    const std::string ALL_BUS_ITEMS = "所有车次";
    const std::string SEARCH_BUS_TICKET = "搜索车票";
    const std::string BUY_BUS_TICKET = "购买车票";
    const std::string REFUND_BUS_TICKET = "退购车票";
    const std::string MODIFY_MY_USER_NAME = "修改用户名";
    const std::string MODIFY_MY_PASSWORD = "修改密码";
    const std::string CHARGE_MY_POCKET = "充值钱包";

    // 其他选项
    const std::string REGISTER_NEW_USER = "注册新用户";

    // 节点专用字符串常量
    const std::string ADMIN_LOGIN_INFO = "请输入管理员密码。";
    const std::string ADMIN_INPUT_PASSWD = "输入管理员密码 ";
    const std::string USER_LOGIN_INFO = "请输入您的用户ID";
    const std::string USER_INPUT_PASSWD = "仅输入您的用户ID ";
    const std::string USER_PASSWD_INPUT_INFO = "请输入账号密码：";
    const std::string MODI_SCHE_INPUT_ID = "输入要修改的列车ID：";

    const std::string NEW_ARRIV_SPOT = "输入新车次到达地点 ";
    const std::string NEW_LAUNC_SPOT = "输入新车次发车地点 ";
    const std::string NEW_LAUNC_TIME = "输入新车次发车时间 ";
    const std::string NEW_DURATION = "输入新车次行程时长 ";
    const std::string NEW_TICKET_PRICE = "输入新车次票价 ";
    const std::string NEW_CAPICITY = "输入新车次载客量 ";
    const std::string NEW_USER_NAME = "输入新用户名 ";
    const std::string NEW_USER_PASSWD = "输入新用户密码 ";

    const std::string CANCEL_BUS_PROMOTE = "输入要取消的列车ID ";
    const std::string CONFIRM_BUS_CANCEL = "确认取消列车：";
    const std::string BUS_DELETE_SUCCESS = "车次删除成功。";
    const std::string MODI_INPUT_USER_ID = "输入要修改的用户ID ";
    const std::string DEL_USER_NAME = "输入要删除的用户ID ";
    const std::string DEL_USER_SUCCESS = "用户删除成功。";
    const std::string ANS_BUS_TITLE = "车次分析：";
    const std::string ANS_BUS_ID = "车次ID：";
    const std::string ANS_BUS_OC_RAT = "上座率：";
    const std::string ANS_BUS_WHERE = "路线：";

    const std::string USER_WELCOME = "欢迎使用TMS！";
    const std::string USER_WALLET_PREFIX = "您的钱包余额：";
    const std::string USER_TICKET_PREFIX = "您的车票数量：";
    const std::string USER_ALL_TICKETS = "所有车票：";
    const std::string USER_SEARCH_BUS_DEST = "输入目的地";
    const std::string PROC_TICKET_PROMOTE = "输入车次ID ";
    const std::string PROC_TICKET_SUCCESS = "购票成功";
    const std::string REFUND_TICKET_PROMOTE = "输入要退票的车票ID ";
    const std::string REFUND_TICKER_SUCCESS = "退票成功。";
    const std::string CHARGE_MONY = "输入充值金额 ";
    const std::string ASK_DELETE_BUS_ID = "输入要删除的车次ID ";
    const std::string DELETE_BUS_SUCCESS = "车次删除成功。";
    const std::string EXPORT_LOG_PATH = "输入导出文件路径 ";
    const std::string EXPORT_LOG_PROMOTE = "导出系统日志文件";
    const std::string EXPORT_LOG_SUCCESS = "系统日志导出成功。";
    const std::string ADD_NEW_BUS = "填写车次表：";
    const std::string ADD_NEW_BUS_SUCCESS = "新车次添加成功！";

    const std::string EXIT_NODE = "退出";
    const std::string MENU_SELECT_L = "选择子菜单[0-";
    const std::string MENU_SELECT_R = "]并按";
    const std::string MENU_SELECT_END = "退出：";
    const std::string HOME_TITLE = "TMS主界面";
    const std::string TMS_VERSION = "0.0.a3b043d";

    // 注册引导
    const std::string WELCOME = "欢迎使用票务管理系统！\n请先输入您的姓名。";
    const std::string ASK_NAME = "您的姓名[字符串]并按[回车]：";
    const std::string GET_ID = "为新账号输入ID\n警告：此为永久性选择。";
    const std::string ASK_ID = "您的用户ID[字符串]并按[回车]：";
    const std::string GET_PASSWD = "为新账号输入初始密码。";
    const std::string ASK_PASSWD = "您的密码[不显示字符]并按[回车]：";
    const std::string THANKS = "您已成功注册！";

#endif
}

#endif